<?
include("common/header.html");
include("common/left.html");
include("common/page.php");

$ac=$GLOBALS['_ac'];
$pw=$GLOBALS['_pw'];
$s= new SoapClient(null,array("location" => "http://localhost/open/openService/pft_insideMX.php","uri" => "www.16u.com?ac_16u=$ac|pw_16u=$pw|auth_16u=true"));

$memberID = $_SESSION['sid'];


$v['title']="淘宝订单";
$currentPage = $_REQUEST["currentPage"] ? $_REQUEST["currentPage"]:1;
$pageSize = $_REQUEST['pageSize'] ? $_REQUEST["pageSize"]:15;
$nowPage = ($currentPage-1)*$pageSize;

// 只查找两小时内，淘宝2小时就自动退款
$time = date('Y-m-d H:i:s', time() - 7200);
$lists = array();
$sql = "select * from pft_taobao_o2o_log  where addtime>'$time' and dstatus=0 order by id desc limit $nowPage,$pageSize ";
$GLOBALS['le']->query($sql);

while($row=$GLOBALS['le']->fetch_assoc()){
	$lists[]=$row;
}



$r = $lists;
$sql="SELECT COUNT(*) as c FROM pft_taobao_o2o_log WHERE addtime>'$time' and dstatus=0";
$GLOBALS['le']->query($sql);
$GLOBALS['le']->fetch_assoc();
$count = $GLOBALS['le']->f('c');



$str="select account from pft_member where id=$memberID";
$GLOBALS['le']->query($str);
$GLOBALS['le']->fetch_assoc();
$account=$GLOBALS['le']->f("account");
?>
<title><?=$v['title']?></title>
<script src="js/ui/PopWindow.js" type="text/javascript"></script>
<script src="js/Calendar.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/default.css"/>
<link rel="stylesheet" type="text/css" href="css/page.css"/>
<link rel="stylesheet" type="text/css" href="css/sell_product.css"/>
<style>
.tishi{color:red;margin-top:5px;}
.wenxin{color:black;font-size:12px;}
</style>
<div class="content">
	 <h3 class="mc_title">
		<span class="mctit_1 "><a href="taobaolist.html"><span class="mctit_2">淘宝订单错误查询</span></a></span>
	</h3>
	<div class="mcsear_box">
		<form action="<?=$_SERVER['PHP_SELF']?>" class="report">
			<input type="hidden" name="act" id="act" />
			<input type="hidden" name="atype" value="<?=$atype?>" />
			<input type="hidden" name="currentPage" value="<?=$currentPage?>"/>
			<input type="hidden" name="status" id="status" value="<?=$_REQUEST['status']?>"/>
	</div>
   <div class="section popupwz">
   <div class="search" id="b_state">
	<!--<a href="/taobaolist.html" class="current">全部</a>
	<a href="/taobaolist.html?s=1" class="">已成功</a>
	<a href="/taobaolist.html?s=2" class="">未成功</a>-->
	<div class="tishi"><span class="wenxin">温馨提示：</span>列表只显示最近2小时内的订单。</div>
    </div>
		<table class="mclist_tab">
			<thead>
				<tr class="thead1">

				<div class="section popupwz">
				<table class="orders" id="orders" >
			<thead> 
			<th width="72" class="tl">淘宝订单</th>
			<th width="160">淘宝卖家</th>
            <th width="137">下单时间</th>
            <th width="100">商品数量</th>
			<?if($access['yd']){?>
			<th width="135">云顶订单号</th>
			<?} else {?>
			<th width="135">票付通订单号</th>
			<?}?>
            <th width="63">状态</th>
			<th width="150">操作</th>
			</thead>
			<tbody>
			<? 
				foreach($r as $row){
					// 成功
					if($row['dstatus']){
						$statusTxt = '<span style="color:green;">成功</span>';
						$actionBtn = '<a href="orderView.html?from=&ordernum='.$row['uu_order_id'].'" target="_blank">查看</a>';
					}else{
						$statusTxt = '<span style="color:red;">失败</span>';
						$actionBtn = '<a href="http://taobao.12301.cc/taobaoErr_m.php?remoteorder='.$row['order_id'].'" target="_blank">查看错误原因</a>';
					}
			?>
        	<tr>
            	<td class="txtleft"><?=$row['order_id']?></td>
                <td><?=$row['seller_nick']?></td>
                <td><?=$row['addtime']?></td>
            	<td><?=$row['num']?></td>
            	<td>
					<?if(is_numeric($row['uu_order_id'])):?>
					<a href="orderView.html?from=buy&ordernum=<?=$row['uu_order_id']?>" target="_blank">
					<?=$row['uu_order_id']?>
					</a>
					<?endif;?>
				</td>
				<td><?=$statusTxt?></td>
				<td><?=$actionBtn?></td>
           	</tr>
			<?};//foreach 结束?>
			</tbody>
		</table>	
	</div>
</thead>
		</table>	
		<?page($count,$currentPage,$pageSize,$order,$by);?>
   </div>
</div>
<?
include("common/footer.html");
?>